/**
 * 
 */
package edu.dfrz.ecommercesys.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import edu.dfrz.ecommercesys.domain.Manager;
import edu.dfrz.ecommercesys.util.DBUtil;

/**
 * @author jeff xu
 *
 */
public class ManagerDaoJDBCImpl implements ManagerDao {

	private static final String ADD = "insert into manager values(?,?,?,?,?)";
	
	private Connection conn = null;
	private PreparedStatement pstmt = null;
	private ResultSet rset = null;
	
	public void add(Manager ma) {
		// TODO Auto-generated method stub
		conn = DBUtil.getInstance().getConn();
		
		System.out.println(conn);
		
		try {
			pstmt = conn.prepareStatement(ADD);
			
			pstmt.setString(1, ma.getLoginId());
			pstmt.setString(2, ma.getLoginPwd());
			pstmt.setString(3, ma.getRealName());
			pstmt.setString(4, ma.getTyped());
			pstmt.setString(5, ma.getStatus());
			
			System.out.println(ADD);
			
			pstmt.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally{
			DBUtil.getInstance().releaseRes(conn, pstmt, null);
		}
		
	}

	public Manager getManagerById(String loginId) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Manager> loadAll() {
		// TODO Auto-generated method stub
		return null;
	}

}
